<div class="row">
    <?php if(count($this->messages)) : ?>
        <?php foreach ($this->messages as $msg) : ?>
            <div class="alert alert-block alert-<?php echo !$this->identity() ? 'danger' : 'success';?>">
                <a class="close" data-dismiss="alert" href="#">×</a>
                <p><?php echo $this->translate($msg) ?></p>
            </div>
        <?php endforeach; ?>
    <?php endif; ?>
    <div class="alert alert-block alert-<?php echo !$this->identity() ? 'danger' : 'success';?>">
        <?php if ($user = $this->identity()) : ?>
            <?php echo 'Logged in as ' . $user->getUsrName(); ?>
        <?php  else : ?>
            <?php echo 'Not logged in'; ?>
        <?php endif; ?>
    </div>
    
    <div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
        <span class="text-center">
        </span>
        <div class="panel panel-primary">
            <div class="panel-heading">
              <h3 class="panel-title">Acesso</h3>
            </div>
            <div class="panel-body">
                <?php
                    $form = $this->form;
                    $form->setAttribute('action', $this->url('authdoctrine/default', array('controller' => 'index', 'action' => 'login')));
                    $form->prepare();
                ?>
                <?php echo $this->form()->openTag($form); ?>
                <div class="form-group <?php echo ($this->formElementErrors($form->get('username'))) ? 'has-error' : '' ; ?>">
                    <?php echo $this->translate($this->formLabel($form->get('username'))); ?>
                    <?php echo $this->formInput($form->get('username')); ?>
                    <div class="help-block col-xs-12">
                        <?php echo $this->translate($this->formElementErrors($form->get('username'))); ?>
                    </div>
                </div>
                <div class="form-group <?php echo ($this->formElementErrors($form->get('password'))) ? 'has-error' : '' ; ?>">
                    <?php echo $this->translate($this->formLabel($form->get('password'))); ?>
                    <?php echo $this->formInput($form->get('password')); ?>
                    <div class="help-block col-xs-12">
                        <?php echo $this->translate($this->formElementErrors($form->get('password'))); ?>
                    </div>
                </div>
                <div class="form-group <?php echo ($this->formElementErrors($form->get('rememberme'))) ? 'has-error' : '' ; ?>">
                    <?php echo $this->formCheckbox($form->get('rememberme')); ?>
                    <?php echo $this->translate($this->formLabel($form->get('rememberme'))); ?>
                    <div class="help-block col-xs-12">
                        <?php echo $this->translate($this->formElementErrors($form->get('rememberme'))); ?>
                    </div>
                </div>
                <div class="col-xs-12">
                    <?php echo $this->formButton()->openTag($form->get('submit')); ?>
                        <i class="fa fa-check"></i> <?php echo $this->translate($form->get('submit')->getValue()); ?>
                    <?php echo $this->formButton()->closeTag(); ?>
                </div>

                <?php echo $this->form()->closeTag(); ?>
            </div>
            <div class="panel-footer text-center">
                <a class="btn btn-primary" href="<?php echo $this->url('authdoctrine/default',array('action'=>'register')); ?>"><?php echo $this->translate('Register') ?> &raquo;</a>
            </div>
        </div>
    </div>
</div>
